{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 学生实践（接week06）：\n",
    "- 思考： contributors 在上图中显示的数量较小，对比不明显，再次观察表格数据\n",
    "- 可以选择 contributors 和 watch 和fork做为一组进行尝试，请同学们进行实践\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"1001\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "  var JS_MIME_TYPE = 'application/javascript';\n",
       "  var HTML_MIME_TYPE = 'text/html';\n",
       "  var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
       "  var CLASS_NAME = 'output_bokeh rendered_html';\n",
       "\n",
       "  /**\n",
       "   * Render data to the DOM node\n",
       "   */\n",
       "  function render(props, node) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    node.appendChild(script);\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when an output is cleared or removed\n",
       "   */\n",
       "  function handleClearOutput(event, handle) {\n",
       "    var cell = handle.cell;\n",
       "\n",
       "    var id = cell.output_area._bokeh_element_id;\n",
       "    var server_id = cell.output_area._bokeh_server_id;\n",
       "    // Clean up Bokeh references\n",
       "    if (id != null && id in Bokeh.index) {\n",
       "      Bokeh.index[id].model.document.clear();\n",
       "      delete Bokeh.index[id];\n",
       "    }\n",
       "\n",
       "    if (server_id !== undefined) {\n",
       "      // Clean up Bokeh references\n",
       "      var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
       "      cell.notebook.kernel.execute(cmd, {\n",
       "        iopub: {\n",
       "          output: function(msg) {\n",
       "            var id = msg.content.text.trim();\n",
       "            if (id in Bokeh.index) {\n",
       "              Bokeh.index[id].model.document.clear();\n",
       "              delete Bokeh.index[id];\n",
       "            }\n",
       "          }\n",
       "        }\n",
       "      });\n",
       "      // Destroy server and session\n",
       "      var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
       "      cell.notebook.kernel.execute(cmd);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when a new output is added\n",
       "   */\n",
       "  function handleAddOutput(event, handle) {\n",
       "    var output_area = handle.output_area;\n",
       "    var output = handle.output;\n",
       "\n",
       "    // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
       "    if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
       "      return\n",
       "    }\n",
       "\n",
       "    var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
       "\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
       "      toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
       "      // store reference to embed id on output_area\n",
       "      output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
       "    }\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
       "      var bk_div = document.createElement(\"div\");\n",
       "      bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
       "      var script_attrs = bk_div.children[0].attributes;\n",
       "      for (var i = 0; i < script_attrs.length; i++) {\n",
       "        toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
       "        toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n",
       "      }\n",
       "      // store reference to server id on output_area\n",
       "      output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function register_renderer(events, OutputArea) {\n",
       "\n",
       "    function append_mime(data, metadata, element) {\n",
       "      // create a DOM node to render to\n",
       "      var toinsert = this.create_output_subarea(\n",
       "        metadata,\n",
       "        CLASS_NAME,\n",
       "        EXEC_MIME_TYPE\n",
       "      );\n",
       "      this.keyboard_manager.register_events(toinsert);\n",
       "      // Render to node\n",
       "      var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
       "      render(props, toinsert[toinsert.length - 1]);\n",
       "      element.append(toinsert);\n",
       "      return toinsert\n",
       "    }\n",
       "\n",
       "    /* Handle when an output is cleared or removed */\n",
       "    events.on('clear_output.CodeCell', handleClearOutput);\n",
       "    events.on('delete.Cell', handleClearOutput);\n",
       "\n",
       "    /* Handle when a new output is added */\n",
       "    events.on('output_added.OutputArea', handleAddOutput);\n",
       "\n",
       "    /**\n",
       "     * Register the mime type and append_mime function with output_area\n",
       "     */\n",
       "    OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
       "      /* Is output safe? */\n",
       "      safe: true,\n",
       "      /* Index of renderer in `output_area.display_order` */\n",
       "      index: 0\n",
       "    });\n",
       "  }\n",
       "\n",
       "  // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
       "  if (root.Jupyter !== undefined) {\n",
       "    var events = require('base/js/events');\n",
       "    var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
       "\n",
       "    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
       "      register_renderer(events, OutputArea);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    var el = document.getElementById(\"1001\");\n",
       "    if (el != null) {\n",
       "      el.textContent = \"BokehJS is loading...\";\n",
       "    }\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) {\n",
       "        if (callback != null)\n",
       "          callback();\n",
       "      });\n",
       "    } finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.debug(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(css_urls, js_urls, callback) {\n",
       "    if (css_urls == null) css_urls = [];\n",
       "    if (js_urls == null) js_urls = [];\n",
       "\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = css_urls.length + js_urls.length;\n",
       "\n",
       "    function on_load() {\n",
       "      root._bokeh_is_loading--;\n",
       "      if (root._bokeh_is_loading === 0) {\n",
       "        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
       "        run_callbacks()\n",
       "      }\n",
       "    }\n",
       "\n",
       "    function on_error() {\n",
       "      console.error(\"failed to load \" + url);\n",
       "    }\n",
       "\n",
       "    for (var i = 0; i < css_urls.length; i++) {\n",
       "      var url = css_urls[i];\n",
       "      const element = document.createElement(\"link\");\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.rel = \"stylesheet\";\n",
       "      element.type = \"text/css\";\n",
       "      element.href = url;\n",
       "      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
       "      document.body.appendChild(element);\n",
       "    }\n",
       "\n",
       "    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\": \"kLr4fYcqcSpbuI95brIH3vnnYCquzzSxHPU6XGQCIkQRGJwhg0StNbj1eegrHs12\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\": \"xIGPmVtaOm+z0BqfSOMn4lOR6ciex448GIKG4eE61LsAvmGj48XcMQZtKcE/UXZe\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\": \"Dc9u1wF/0zApGIWoBbH77iWEHtdmkuYWG839Uzmv8y8yBLXebjO9ZnERsde5Ln/P\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\": \"cT9JaBz7GiRXdENrJLZNSC6eMNF3nh3fa5fTF51Svp+ukxPdwcU5kGXGPBgDCa2j\"};\n",
       "\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var element = document.createElement('script');\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.async = false;\n",
       "      element.src = url;\n",
       "      if (url in hashes) {\n",
       "        element.crossOrigin = \"anonymous\";\n",
       "        element.integrity = \"sha384-\" + hashes[url];\n",
       "      }\n",
       "      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.head.appendChild(element);\n",
       "    }\n",
       "  };\n",
       "\n",
       "  function inject_raw_css(css) {\n",
       "    const element = document.createElement(\"style\");\n",
       "    element.appendChild(document.createTextNode(css));\n",
       "    document.body.appendChild(element);\n",
       "  }\n",
       "\n",
       "  \n",
       "  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\"];\n",
       "  var css_urls = [];\n",
       "  \n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "    \n",
       "    \n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if (root.Bokeh !== undefined || force === true) {\n",
       "      \n",
       "    for (var i = 0; i < inline_js.length; i++) {\n",
       "      inline_js[i].call(root, root.Bokeh);\n",
       "    }\n",
       "    if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"1001\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(css_urls, js_urls, function() {\n",
       "      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ],
      "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  var force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\n  \n\n  \n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  var NB_LOAD_WARNING = {'data': {'text/html':\n     \"<div style='background-color: #fdd'>\\n\"+\n     \"<p>\\n\"+\n     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n     \"</p>\\n\"+\n     \"<ul>\\n\"+\n     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n     \"</ul>\\n\"+\n     \"<code>\\n\"+\n     \"from bokeh.resources import INLINE\\n\"+\n     \"output_notebook(resources=INLINE)\\n\"+\n     \"</code>\\n\"+\n     \"</div>\"}};\n\n  function display_loaded() {\n    var el = document.getElementById(\"1001\");\n    if (el != null) {\n      el.textContent = \"BokehJS is loading...\";\n    }\n    if (root.Bokeh !== undefined) {\n      if (el != null) {\n        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n      }\n    } else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(display_loaded, 100)\n    }\n  }\n\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls == null || js_urls.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n    root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error() {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (var i = 0; i < css_urls.length; i++) {\n      var url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\": \"kLr4fYcqcSpbuI95brIH3vnnYCquzzSxHPU6XGQCIkQRGJwhg0StNbj1eegrHs12\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\": \"xIGPmVtaOm+z0BqfSOMn4lOR6ciex448GIKG4eE61LsAvmGj48XcMQZtKcE/UXZe\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\": \"Dc9u1wF/0zApGIWoBbH77iWEHtdmkuYWG839Uzmv8y8yBLXebjO9ZnERsde5Ln/P\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\": \"cT9JaBz7GiRXdENrJLZNSC6eMNF3nh3fa5fTF51Svp+ukxPdwcU5kGXGPBgDCa2j\"};\n\n    for (var i = 0; i < js_urls.length; i++) {\n      var url = js_urls[i];\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      if (url in hashes) {\n        element.crossOrigin = \"anonymous\";\n        element.integrity = \"sha384-\" + hashes[url];\n      }\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  \n  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\"];\n  var css_urls = [];\n  \n\n  var inline_js = [\n    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\n    function(Bokeh) {\n    \n    \n    }\n  ];\n\n  function run_inline_js() {\n    \n    if (root.Bokeh !== undefined || force === true) {\n      \n    for (var i = 0; i < inline_js.length; i++) {\n      inline_js[i].call(root, root.Bokeh);\n    }\n    if (force === true) {\n        display_loaded();\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    } else if (force !== true) {\n      var cell = $(document.getElementById(\"1001\")).parents('.cell').data().cell;\n      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n    }\n\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));"
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Visualization_tools</th>\n",
       "      <th>Watch</th>\n",
       "      <th>Star</th>\n",
       "      <th>Fork</th>\n",
       "      <th>Commits</th>\n",
       "      <th>Contributors</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>matplotlib</td>\n",
       "      <td>533</td>\n",
       "      <td>9678</td>\n",
       "      <td>4143</td>\n",
       "      <td>29503</td>\n",
       "      <td>808</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>bokeh</td>\n",
       "      <td>396</td>\n",
       "      <td>11034</td>\n",
       "      <td>2526</td>\n",
       "      <td>17673</td>\n",
       "      <td>357</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>pyecharts</td>\n",
       "      <td>263</td>\n",
       "      <td>5387</td>\n",
       "      <td>1148</td>\n",
       "      <td>1321</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>seaborn</td>\n",
       "      <td>234</td>\n",
       "      <td>6038</td>\n",
       "      <td>970</td>\n",
       "      <td>2316</td>\n",
       "      <td>98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>plotly</td>\n",
       "      <td>234</td>\n",
       "      <td>4928</td>\n",
       "      <td>1114</td>\n",
       "      <td>3370</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>ggplot2</td>\n",
       "      <td>329</td>\n",
       "      <td>3783</td>\n",
       "      <td>1427</td>\n",
       "      <td>4286</td>\n",
       "      <td>184</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Visualization_tools  Watch   Star  Fork  Commits  Contributors\n",
       "0          matplotlib    533   9678  4143    29503           808\n",
       "1               bokeh    396  11034  2526    17673           357\n",
       "2           pyecharts    263   5387  1148     1321            18\n",
       "3             seaborn    234   6038   970     2316            98\n",
       "4              plotly    234   4928  1114     3370            76\n",
       "5             ggplot2    329   3783  1427     4286           184"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 数据准备：\n",
    "from bokeh.models import ColumnDataSource, FactorRange\n",
    "from bokeh.palettes import Spectral6\n",
    "import pandas as pd\n",
    "from bokeh.plotting import output_notebook,figure,show\n",
    "from bokeh.transform import factor_cmap\n",
    "output_notebook()\n",
    "pd.read_csv('data/visualization-20190505.csv')\n",
    "df = pd.read_csv('data/visualization-20190505.csv')\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Visualization_tools', 'Watch', 'Star', 'Fork', 'Commits', 'Contributors']"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns.tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Star', 'Commits']"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "group1 = [df.columns.tolist()[2],df.columns.tolist()[4]]\n",
    "group1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Watch', 'Fork', 'Contributors']"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "group2 = [df.columns.tolist()[1],df.columns.tolist()[3],df.columns.tolist()[5]]\n",
    "group2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    matplotlib\n",
       "1         bokeh\n",
       "2     pyecharts\n",
       "3       seaborn\n",
       "4        plotly\n",
       "5       ggplot2\n",
       "Name: Visualization_tools, dtype: object"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tools = df['Visualization_tools']\n",
    "tools"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Star和Commits为一组"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('matplotlib', 'Star'),\n",
       " ('matplotlib', 'Commits'),\n",
       " ('bokeh', 'Star'),\n",
       " ('bokeh', 'Commits'),\n",
       " ('pyecharts', 'Star'),\n",
       " ('pyecharts', 'Commits'),\n",
       " ('seaborn', 'Star'),\n",
       " ('seaborn', 'Commits'),\n",
       " ('plotly', 'Star'),\n",
       " ('plotly', 'Commits'),\n",
       " ('ggplot2', 'Star'),\n",
       " ('ggplot2', 'Commits')]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x = [ (tool, categroy) for tool in tools for categroy in group1 ]\n",
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(9678, 29503, 11034, 17673, 5387, 1321, 6038, 2316, 4928, 3370, 3783, 4286)\n"
     ]
    }
   ],
   "source": [
    "counts = sum(zip(df['Star'], df['Commits']), ())\n",
    "print(counts)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "source = ColumnDataSource(data=dict(x=x, counts=counts))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"f9c53001-5998-46ea-b0ce-4ce47b2510ba\" data-root-id=\"1004\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"12ac7cc3-a336-41eb-a493-0aea0c4a0ea8\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1014\"}],\"center\":[{\"id\":\"1016\"},{\"id\":\"1020\"}],\"left\":[{\"id\":\"1017\"}],\"plot_height\":350,\"renderers\":[{\"id\":\"1041\"}],\"title\":{\"id\":\"1005\"},\"toolbar\":{\"id\":\"1029\"},\"x_range\":{\"id\":\"1003\"},\"x_scale\":{\"id\":\"1010\"},\"y_range\":{\"id\":\"1008\"},\"y_scale\":{\"id\":\"1012\"}},\"id\":\"1004\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1010\",\"type\":\"CategoricalScale\"},{\"attributes\":{},\"id\":\"1045\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1022\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1047\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{},\"id\":\"1012\",\"type\":\"LinearScale\"},{\"attributes\":{\"factors\":[[\"matplotlib\",\"Star\"],[\"matplotlib\",\"Commits\"],[\"bokeh\",\"Star\"],[\"bokeh\",\"Commits\"],[\"pyecharts\",\"Star\"],[\"pyecharts\",\"Commits\"],[\"seaborn\",\"Star\"],[\"seaborn\",\"Commits\"],[\"plotly\",\"Star\"],[\"plotly\",\"Commits\"],[\"ggplot2\",\"Star\"],[\"ggplot2\",\"Commits\"]],\"range_padding\":0.1},\"id\":\"1003\",\"type\":\"FactorRange\"},{\"attributes\":{\"data_source\":{\"id\":\"1002\"},\"glyph\":{\"id\":\"1039\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1040\"},\"selection_glyph\":null,\"view\":{\"id\":\"1042\"}},\"id\":\"1041\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"text\":\"Fruit Counts by Year\"},\"id\":\"1005\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1048\",\"type\":\"Selection\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1021\"},{\"id\":\"1022\"},{\"id\":\"1023\"},{\"id\":\"1024\"},{\"id\":\"1025\"},{\"id\":\"1026\"},{\"id\":\"1028\"}]},\"id\":\"1029\",\"type\":\"Toolbar\"},{\"attributes\":{\"axis\":{\"id\":\"1017\"},\"dimension\":1,\"ticker\":null},\"id\":\"1020\",\"type\":\"Grid\"},{\"attributes\":{\"data\":{\"counts\":[9678,29503,11034,17673,5387,1321,6038,2316,4928,3370,3783,4286],\"x\":[[\"matplotlib\",\"Star\"],[\"matplotlib\",\"Commits\"],[\"bokeh\",\"Star\"],[\"bokeh\",\"Commits\"],[\"pyecharts\",\"Star\"],[\"pyecharts\",\"Commits\"],[\"seaborn\",\"Star\"],[\"seaborn\",\"Commits\"],[\"plotly\",\"Star\"],[\"plotly\",\"Commits\"],[\"ggplot2\",\"Star\"],[\"ggplot2\",\"Commits\"]]},\"selected\":{\"id\":\"1048\"},\"selection_policy\":{\"id\":\"1049\"}},\"id\":\"1002\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1021\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1015\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"formatter\":{\"id\":\"1045\"},\"ticker\":{\"id\":\"1018\"}},\"id\":\"1017\",\"type\":\"LinearAxis\"},{\"attributes\":{\"axis\":{\"id\":\"1014\"},\"grid_line_color\":null,\"ticker\":null},\"id\":\"1016\",\"type\":\"Grid\"},{\"attributes\":{\"source\":{\"id\":\"1002\"}},\"id\":\"1042\",\"type\":\"CDSView\"},{\"attributes\":{\"end\":2,\"factors\":[\"Star\",\"Commits\"],\"palette\":[\"red\",\"green\"],\"start\":1},\"id\":\"1037\",\"type\":\"CategoricalColorMapper\"},{\"attributes\":{\"fill_color\":{\"field\":\"x\",\"transform\":{\"id\":\"1037\"}},\"line_color\":{\"value\":\"white\"},\"top\":{\"field\":\"counts\"},\"width\":{\"value\":0.9},\"x\":{\"field\":\"x\"}},\"id\":\"1039\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"1049\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1027\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1024\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1026\",\"type\":\"HelpTool\"},{\"attributes\":{\"formatter\":{\"id\":\"1047\"},\"major_label_orientation\":1,\"ticker\":{\"id\":\"1015\"}},\"id\":\"1014\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"start\":0},\"id\":\"1008\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1018\",\"type\":\"BasicTicker\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"count\",\"@counts\"]]},\"id\":\"1028\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"1025\",\"type\":\"ResetTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1027\"}},\"id\":\"1023\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"field\":\"x\",\"transform\":{\"id\":\"1037\"}},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"white\"},\"top\":{\"field\":\"counts\"},\"width\":{\"value\":0.9},\"x\":{\"field\":\"x\"}},\"id\":\"1040\",\"type\":\"VBar\"}],\"root_ids\":[\"1004\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"12ac7cc3-a336-41eb-a493-0aea0c4a0ea8\",\"root_ids\":[\"1004\"],\"roots\":{\"1004\":\"f9c53001-5998-46ea-b0ce-4ce47b2510ba\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1004"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "TOOLTIPS = [\n",
    "    (\"count\", \"@counts\")\n",
    "]\n",
    "# 画布\n",
    "p = figure(x_range=FactorRange(*x), plot_height=350, title=\"Fruit Counts by Year\",tooltips=TOOLTIPS\n",
    "#            toolbar_location=None, tools=\"\"\n",
    "          )\n",
    "\n",
    "palette = [\"red\", \"green\"]\n",
    "\n",
    "# 绘图\n",
    "p.vbar(x='x',\n",
    "       top='counts',\n",
    "       width=0.9,\n",
    "       source=source,\n",
    "       line_color=\"white\",\n",
    "       fill_color=factor_cmap('x', palette=palette, factors=group1, start=1, end=2)\n",
    ")\n",
    "\n",
    "# 其他\n",
    "p.y_range.start = 0\n",
    "p.x_range.range_padding = 0.1\n",
    "p.xaxis.major_label_orientation = 1\n",
    "p.xgrid.grid_line_color = None\n",
    "# 显示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Watch、Fork、Contributors为一组"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('matplotlib', 'Watch'),\n",
       " ('matplotlib', 'Fork'),\n",
       " ('matplotlib', 'Contributors'),\n",
       " ('bokeh', 'Watch'),\n",
       " ('bokeh', 'Fork'),\n",
       " ('bokeh', 'Contributors'),\n",
       " ('pyecharts', 'Watch'),\n",
       " ('pyecharts', 'Fork'),\n",
       " ('pyecharts', 'Contributors'),\n",
       " ('seaborn', 'Watch'),\n",
       " ('seaborn', 'Fork'),\n",
       " ('seaborn', 'Contributors'),\n",
       " ('plotly', 'Watch'),\n",
       " ('plotly', 'Fork'),\n",
       " ('plotly', 'Contributors'),\n",
       " ('ggplot2', 'Watch'),\n",
       " ('ggplot2', 'Fork'),\n",
       " ('ggplot2', 'Contributors')]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x = [ (tool, categroy) for tool in tools for categroy in group2 ]\n",
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(533, 4143, 808, 396, 2526, 357, 263, 1148, 18, 234, 970, 98, 234, 1114, 76, 329, 1427, 184)\n"
     ]
    }
   ],
   "source": [
    "counts = sum(zip(df['Watch'],df['Fork'], df['Contributors']), ())\n",
    "print(counts)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "source = ColumnDataSource(data=dict(x=x,counts=counts))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"175522d3-1f3b-4a16-8b7f-c50953df143f\" data-root-id=\"1101\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"98a11273-c61d-4f87-ab43-f16b81591a5d\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1111\"}],\"center\":[{\"id\":\"1113\"},{\"id\":\"1117\"}],\"left\":[{\"id\":\"1114\"}],\"plot_height\":350,\"renderers\":[{\"id\":\"1138\"}],\"title\":{\"id\":\"1102\"},\"toolbar\":{\"id\":\"1126\"},\"x_range\":{\"id\":\"1100\"},\"x_scale\":{\"id\":\"1107\"},\"y_range\":{\"id\":\"1105\"},\"y_scale\":{\"id\":\"1109\"}},\"id\":\"1101\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1154\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1122\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1115\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1153\",\"type\":\"Selection\"},{\"attributes\":{\"axis\":{\"id\":\"1114\"},\"dimension\":1,\"ticker\":null},\"id\":\"1117\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1152\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{},\"id\":\"1121\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1112\",\"type\":\"CategoricalTicker\"},{\"attributes\":{},\"id\":\"1118\",\"type\":\"PanTool\"},{\"attributes\":{\"factors\":[[\"matplotlib\",\"Watch\"],[\"matplotlib\",\"Fork\"],[\"matplotlib\",\"Contributors\"],[\"bokeh\",\"Watch\"],[\"bokeh\",\"Fork\"],[\"bokeh\",\"Contributors\"],[\"pyecharts\",\"Watch\"],[\"pyecharts\",\"Fork\"],[\"pyecharts\",\"Contributors\"],[\"seaborn\",\"Watch\"],[\"seaborn\",\"Fork\"],[\"seaborn\",\"Contributors\"],[\"plotly\",\"Watch\"],[\"plotly\",\"Fork\"],[\"plotly\",\"Contributors\"],[\"ggplot2\",\"Watch\"],[\"ggplot2\",\"Fork\"],[\"ggplot2\",\"Contributors\"]],\"range_padding\":0.1},\"id\":\"1100\",\"type\":\"FactorRange\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"field\":\"x\",\"transform\":{\"id\":\"1134\"}},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"white\"},\"top\":{\"field\":\"counts\"},\"width\":{\"value\":0.9},\"x\":{\"field\":\"x\"}},\"id\":\"1137\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"1150\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"start\":0},\"id\":\"1105\",\"type\":\"DataRange1d\"},{\"attributes\":{\"source\":{\"id\":\"1099\"}},\"id\":\"1139\",\"type\":\"CDSView\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1118\"},{\"id\":\"1119\"},{\"id\":\"1120\"},{\"id\":\"1121\"},{\"id\":\"1122\"},{\"id\":\"1123\"},{\"id\":\"1125\"}]},\"id\":\"1126\",\"type\":\"Toolbar\"},{\"attributes\":{\"overlay\":{\"id\":\"1124\"}},\"id\":\"1120\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"axis\":{\"id\":\"1111\"},\"grid_line_color\":null,\"ticker\":null},\"id\":\"1113\",\"type\":\"Grid\"},{\"attributes\":{\"formatter\":{\"id\":\"1150\"},\"ticker\":{\"id\":\"1115\"}},\"id\":\"1114\",\"type\":\"LinearAxis\"},{\"attributes\":{\"fill_color\":{\"field\":\"x\",\"transform\":{\"id\":\"1134\"}},\"line_color\":{\"value\":\"white\"},\"top\":{\"field\":\"counts\"},\"width\":{\"value\":0.9},\"x\":{\"field\":\"x\"}},\"id\":\"1136\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"1119\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"1099\"},\"glyph\":{\"id\":\"1136\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1137\"},\"selection_glyph\":null,\"view\":{\"id\":\"1139\"}},\"id\":\"1138\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"count\",\"@counts\"]]},\"id\":\"1125\",\"type\":\"HoverTool\"},{\"attributes\":{\"end\":2,\"factors\":[\"Watch\",\"Fork\",\"Contributors\"],\"palette\":[\"red\",\"green\",\"blue\"],\"start\":1},\"id\":\"1134\",\"type\":\"CategoricalColorMapper\"},{\"attributes\":{},\"id\":\"1107\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1124\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"formatter\":{\"id\":\"1152\"},\"major_label_orientation\":1,\"ticker\":{\"id\":\"1112\"}},\"id\":\"1111\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"data\":{\"counts\":[533,4143,808,396,2526,357,263,1148,18,234,970,98,234,1114,76,329,1427,184],\"x\":[[\"matplotlib\",\"Watch\"],[\"matplotlib\",\"Fork\"],[\"matplotlib\",\"Contributors\"],[\"bokeh\",\"Watch\"],[\"bokeh\",\"Fork\"],[\"bokeh\",\"Contributors\"],[\"pyecharts\",\"Watch\"],[\"pyecharts\",\"Fork\"],[\"pyecharts\",\"Contributors\"],[\"seaborn\",\"Watch\"],[\"seaborn\",\"Fork\"],[\"seaborn\",\"Contributors\"],[\"plotly\",\"Watch\"],[\"plotly\",\"Fork\"],[\"plotly\",\"Contributors\"],[\"ggplot2\",\"Watch\"],[\"ggplot2\",\"Fork\"],[\"ggplot2\",\"Contributors\"]]},\"selected\":{\"id\":\"1153\"},\"selection_policy\":{\"id\":\"1154\"}},\"id\":\"1099\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1109\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1123\",\"type\":\"HelpTool\"},{\"attributes\":{\"text\":\"Fruit Counts by Year\"},\"id\":\"1102\",\"type\":\"Title\"}],\"root_ids\":[\"1101\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"98a11273-c61d-4f87-ab43-f16b81591a5d\",\"root_ids\":[\"1101\"],\"roots\":{\"1101\":\"175522d3-1f3b-4a16-8b7f-c50953df143f\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1101"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "TOOLTIPS = [\n",
    "    (\"count\", \"@counts\")\n",
    "]\n",
    "# 画布\n",
    "p = figure(x_range=FactorRange(*x), plot_height=350, title=\"Fruit Counts by Year\",tooltips=TOOLTIPS\n",
    "          )\n",
    "\n",
    "palette = [\"red\", \"green\", \"blue\"]\n",
    "\n",
    "# 绘图\n",
    "p.vbar(x='x',\n",
    "       top='counts',\n",
    "       width=0.9,\n",
    "       source=source,\n",
    "       line_color=\"white\",\n",
    "       fill_color=factor_cmap('x', palette=palette, factors=group2, start=1, end=2)\n",
    ")\n",
    "\n",
    "# 其他\n",
    "p.y_range.start = 0\n",
    "p.x_range.range_padding = 0.1\n",
    "p.xaxis.major_label_orientation = 1\n",
    "p.xgrid.grid_line_color = None\n",
    "# 显示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 本周学习_分组 统计柱状图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Visualization_tools</th>\n",
       "      <th>Watch</th>\n",
       "      <th>Star</th>\n",
       "      <th>Fork</th>\n",
       "      <th>Commits</th>\n",
       "      <th>Contributors</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>matplotlib</td>\n",
       "      <td>533</td>\n",
       "      <td>9678</td>\n",
       "      <td>4143</td>\n",
       "      <td>29503</td>\n",
       "      <td>808</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>bokeh</td>\n",
       "      <td>396</td>\n",
       "      <td>11034</td>\n",
       "      <td>2526</td>\n",
       "      <td>17673</td>\n",
       "      <td>357</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>pyecharts</td>\n",
       "      <td>263</td>\n",
       "      <td>5387</td>\n",
       "      <td>1148</td>\n",
       "      <td>1321</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>seaborn</td>\n",
       "      <td>234</td>\n",
       "      <td>6038</td>\n",
       "      <td>970</td>\n",
       "      <td>2316</td>\n",
       "      <td>98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>plotly</td>\n",
       "      <td>234</td>\n",
       "      <td>4928</td>\n",
       "      <td>1114</td>\n",
       "      <td>3370</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>ggplot2</td>\n",
       "      <td>329</td>\n",
       "      <td>3783</td>\n",
       "      <td>1427</td>\n",
       "      <td>4286</td>\n",
       "      <td>184</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Visualization_tools  Watch   Star  Fork  Commits  Contributors\n",
       "0          matplotlib    533   9678  4143    29503           808\n",
       "1               bokeh    396  11034  2526    17673           357\n",
       "2           pyecharts    263   5387  1148     1321            18\n",
       "3             seaborn    234   6038   970     2316            98\n",
       "4              plotly    234   4928  1114     3370            76\n",
       "5             ggplot2    329   3783  1427     4286           184"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 准备x轴坐标数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['Visualization_tools', 'Watch', 'Star', 'Fork', 'Commits',\n",
       "       'Contributors'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Visualization_tools', 'Watch', 'Star', 'Fork', 'Commits', 'Contributors']"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns.tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "## 元组常常在数据科学中用于 malti 复合数据（分组数据/多个层级的数据）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Star', 'Commits', 'Contributors']"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "## 二级数据准备——对应示例代码年份数据() (元组的第二个位置)\n",
    "vis_tools_categroy = [df.columns.tolist()[2],df.columns.tolist()[4],df.columns.tolist()[5]]\n",
    "vis_tools_categroy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    matplotlib\n",
       "1         bokeh\n",
       "2     pyecharts\n",
       "3       seaborn\n",
       "4        plotly\n",
       "5       ggplot2\n",
       "Name: Visualization_tools, dtype: object"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "## 一级数据准备 (元组的第一个位置)\n",
    "df['Visualization_tools']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 列表推导式准备x轴 多级数据\n",
    "x=[(tool,categroy) for tool in df['Visualization_tools'] for categroy in vis_tools_categroy]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('matplotlib', 'Star'),\n",
       " ('matplotlib', 'Commits'),\n",
       " ('matplotlib', 'Contributors'),\n",
       " ('bokeh', 'Star'),\n",
       " ('bokeh', 'Commits'),\n",
       " ('bokeh', 'Contributors'),\n",
       " ('pyecharts', 'Star'),\n",
       " ('pyecharts', 'Commits'),\n",
       " ('pyecharts', 'Contributors'),\n",
       " ('seaborn', 'Star'),\n",
       " ('seaborn', 'Commits'),\n",
       " ('seaborn', 'Contributors'),\n",
       " ('plotly', 'Star'),\n",
       " ('plotly', 'Commits'),\n",
       " ('plotly', 'Contributors'),\n",
       " ('ggplot2', 'Star'),\n",
       " ('ggplot2', 'Commits'),\n",
       " ('ggplot2', 'Contributors')]"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "18"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(x)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 准备y轴坐标数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(533,\n",
       " 4143,\n",
       " 808,\n",
       " 396,\n",
       " 2526,\n",
       " 357,\n",
       " 263,\n",
       " 1148,\n",
       " 18,\n",
       " 234,\n",
       " 970,\n",
       " 98,\n",
       " 234,\n",
       " 1114,\n",
       " 76,\n",
       " 329,\n",
       " 1427,\n",
       " 184)"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "counts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<zip at 0x13ffd20c340>"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "zip(df['Star'],df['Commits'],df['Contributors'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "y= sum(zip(df['Star'],df['Commits'],df['Contributors']),())   # 分组求和（堆叠总数）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(9678, 29503, 808, 11034, 17673, 357, 5387, 1321, 18, 6038, 2316, 98, 4928, 3370, 76, 3783, 4286, 184)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "18"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print(y)\n",
    "len(y)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.数据准备ColumnDataSource"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "('#99d594', '#ffffbf', '#fc8d59')"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from bokeh.palettes import Spectral3\n",
    "Spectral3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"3a99e374-a951-4414-9d7b-f22b5c094102\" data-root-id=\"1206\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"b690d4ea-91f3-4a6e-becc-f5e54ccb3972\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1216\"}],\"center\":[{\"id\":\"1218\"},{\"id\":\"1222\"}],\"left\":[{\"id\":\"1219\"}],\"plot_height\":350,\"renderers\":[{\"id\":\"1243\"}],\"title\":{\"id\":\"1207\"},\"toolbar\":{\"id\":\"1231\"},\"x_range\":{\"id\":\"1205\"},\"x_scale\":{\"id\":\"1212\"},\"y_range\":{\"id\":\"1210\"},\"y_scale\":{\"id\":\"1214\"}},\"id\":\"1206\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1223\"},{\"id\":\"1224\"},{\"id\":\"1225\"},{\"id\":\"1226\"},{\"id\":\"1227\"},{\"id\":\"1228\"},{\"id\":\"1230\"}]},\"id\":\"1231\",\"type\":\"Toolbar\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"field\":\"x_axis\",\"transform\":{\"id\":\"1239\"}},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"y_counts\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x_axis\"}},\"id\":\"1242\",\"type\":\"VBar\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"counts\",\"@y_counts\"],[\"tools\",\"@x_axis\"]]},\"id\":\"1230\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"1266\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1212\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"overlay\":{\"id\":\"1229\"}},\"id\":\"1225\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"factors\":[[\"matplotlib\",\"Star\"],[\"matplotlib\",\"Commits\"],[\"matplotlib\",\"Contributors\"],[\"bokeh\",\"Star\"],[\"bokeh\",\"Commits\"],[\"bokeh\",\"Contributors\"],[\"pyecharts\",\"Star\"],[\"pyecharts\",\"Commits\"],[\"pyecharts\",\"Contributors\"],[\"seaborn\",\"Star\"],[\"seaborn\",\"Commits\"],[\"seaborn\",\"Contributors\"],[\"plotly\",\"Star\"],[\"plotly\",\"Commits\"],[\"plotly\",\"Contributors\"],[\"ggplot2\",\"Star\"],[\"ggplot2\",\"Commits\"],[\"ggplot2\",\"Contributors\"]],\"range_padding\":0.1},\"id\":\"1205\",\"type\":\"FactorRange\"},{\"attributes\":{\"end\":2,\"factors\":[\"Star\",\"Commits\",\"Contributors\"],\"palette\":[\"#99d594\",\"#ffffbf\",\"#fc8d59\"],\"start\":1},\"id\":\"1239\",\"type\":\"CategoricalColorMapper\"},{\"attributes\":{},\"id\":\"1263\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_color\":{\"field\":\"x_axis\",\"transform\":{\"id\":\"1239\"}},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"y_counts\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x_axis\"}},\"id\":\"1241\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"1220\",\"type\":\"BasicTicker\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1229\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"data\":{\"x_axis\":[[\"matplotlib\",\"Star\"],[\"matplotlib\",\"Commits\"],[\"matplotlib\",\"Contributors\"],[\"bokeh\",\"Star\"],[\"bokeh\",\"Commits\"],[\"bokeh\",\"Contributors\"],[\"pyecharts\",\"Star\"],[\"pyecharts\",\"Commits\"],[\"pyecharts\",\"Contributors\"],[\"seaborn\",\"Star\"],[\"seaborn\",\"Commits\"],[\"seaborn\",\"Contributors\"],[\"plotly\",\"Star\"],[\"plotly\",\"Commits\"],[\"plotly\",\"Contributors\"],[\"ggplot2\",\"Star\"],[\"ggplot2\",\"Commits\"],[\"ggplot2\",\"Contributors\"]],\"y_counts\":[9678,29503,808,11034,17673,357,5387,1321,18,6038,2316,98,4928,3370,76,3783,4286,184]},\"selected\":{\"id\":\"1266\"},\"selection_policy\":{\"id\":\"1267\"}},\"id\":\"1204\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1265\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{},\"id\":\"1223\",\"type\":\"PanTool\"},{\"attributes\":{\"data_source\":{\"id\":\"1204\"},\"glyph\":{\"id\":\"1241\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1242\"},\"selection_glyph\":null,\"view\":{\"id\":\"1244\"}},\"id\":\"1243\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"formatter\":{\"id\":\"1265\"},\"major_label_orientation\":1,\"ticker\":{\"id\":\"1217\"}},\"id\":\"1216\",\"type\":\"CategoricalAxis\"},{\"attributes\":{},\"id\":\"1267\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1227\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1224\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"formatter\":{\"id\":\"1263\"},\"ticker\":{\"id\":\"1220\"}},\"id\":\"1219\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1228\",\"type\":\"HelpTool\"},{\"attributes\":{\"start\":0},\"id\":\"1210\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1217\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"text\":\"\\u53ef\\u89c6\\u5316\\u6a21\\u5757\\u5728github\\u7684\\u4f7f\\u7528\\u6570\\u636e\"},\"id\":\"1207\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1226\",\"type\":\"SaveTool\"},{\"attributes\":{\"axis\":{\"id\":\"1216\"},\"ticker\":null},\"id\":\"1218\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1214\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis\":{\"id\":\"1219\"},\"dimension\":1,\"ticker\":null},\"id\":\"1222\",\"type\":\"Grid\"},{\"attributes\":{\"source\":{\"id\":\"1204\"}},\"id\":\"1244\",\"type\":\"CDSView\"}],\"root_ids\":[\"1206\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"b690d4ea-91f3-4a6e-becc-f5e54ccb3972\",\"root_ids\":[\"1206\"],\"roots\":{\"1206\":\"3a99e374-a951-4414-9d7b-f22b5c094102\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1206"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.transform import factor_cmap\n",
    "source = ColumnDataSource(\n",
    "    data = dict(\n",
    "        x_axis = x,\n",
    "        y_counts = y,     \n",
    "    )\n",
    ")\n",
    "color = Spectral3\n",
    "# 点击数据 tooltips\n",
    "TOOLTIPS = [\n",
    "    (\"counts\",\"@y_counts\"),\n",
    "    (\"tools\",\"@x_axis\")\n",
    "]\n",
    "# 画布\n",
    "p = figure(\n",
    "    x_range=FactorRange(*x),\n",
    "    plot_height=350,\n",
    "    title=\"可视化模块在github的使用数据\",\n",
    "    tooltips=TOOLTIPS\n",
    ")\n",
    "# 绘制图形 vbar 垂直柱状图\n",
    "p.vbar(\n",
    "    x='x_axis',\n",
    "    top=\"y_counts\",\n",
    "    width=0.8,\n",
    "    source=source,\n",
    "    fill_color=factor_cmap('x_axis', palette=color, factors=vis_tools_categroy, start=1, end=2)\n",
    ")\n",
    "p.y_range.start = 0\n",
    "p.x_range.range_padding = 0.1\n",
    "p.xaxis.major_label_orientation = 1\n",
    "\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 作业： 985院校数据，尝试分组柱状图、折线图、散点图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>账号名称</th>\n",
       "      <th>认证名称</th>\n",
       "      <th>抖音号</th>\n",
       "      <th>简介</th>\n",
       "      <th>获赞数_int</th>\n",
       "      <th>粉丝数_int</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>清华大学</td>\n",
       "      <td>清华大学官方抖音号</td>\n",
       "      <td>Tsinghua1911</td>\n",
       "      <td>自强不息 厚德载物在这里你将看到不一样的清华大学</td>\n",
       "      <td>28768000</td>\n",
       "      <td>7156000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>北京大学</td>\n",
       "      <td>北京大学官方抖音号</td>\n",
       "      <td>PKU_1898</td>\n",
       "      <td>直播预告：3.15 15:00 中国经济观察3.16 19:00古代希腊的英雄主义3.17 ...</td>\n",
       "      <td>32159000</td>\n",
       "      <td>6267000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>国防科技大学</td>\n",
       "      <td>国防科技大学官方抖音号</td>\n",
       "      <td>1979202900</td>\n",
       "      <td>厚德博学，强军兴国投稿邮箱：nudtdy@qq.com</td>\n",
       "      <td>63277000</td>\n",
       "      <td>4230000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>浙江大学</td>\n",
       "      <td>浙江大学官方账号</td>\n",
       "      <td>zju1897</td>\n",
       "      <td>求是 创新在这里记录不一样的浙大</td>\n",
       "      <td>36419000</td>\n",
       "      <td>1746000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>武汉大学</td>\n",
       "      <td>武汉大学官方抖音</td>\n",
       "      <td>luojia1893</td>\n",
       "      <td>珞珈之山 东湖之水 山高水长 流风甚美投稿邮箱：whuvideo@163.com</td>\n",
       "      <td>16573000</td>\n",
       "      <td>1310000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>上海交通大学</td>\n",
       "      <td>上海交通大学官方抖音账号</td>\n",
       "      <td>SJTU</td>\n",
       "      <td>饮水思源，爱国荣校。投稿及联系邮箱：zxyzaa-0210@sjtu.edu.cn</td>\n",
       "      <td>12331000</td>\n",
       "      <td>1112000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>复旦大学</td>\n",
       "      <td>复旦大学官方抖音</td>\n",
       "      <td>FDU1905</td>\n",
       "      <td>博学而笃志 切问而近思</td>\n",
       "      <td>3094000</td>\n",
       "      <td>1037000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>北京师范大学</td>\n",
       "      <td>北京师范大学官方抖音号</td>\n",
       "      <td>bnu1902</td>\n",
       "      <td>咦，被你发现了！</td>\n",
       "      <td>5942000</td>\n",
       "      <td>941000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>华中科技大学</td>\n",
       "      <td>华中科技大学官方账号</td>\n",
       "      <td>hust_1952</td>\n",
       "      <td>华中大官抖，带你了解不一样的华中科技大学</td>\n",
       "      <td>13734000</td>\n",
       "      <td>881000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>中国人民大学</td>\n",
       "      <td>中国人民大学官方账号</td>\n",
       "      <td>RUC1937</td>\n",
       "      <td>国民表率 社会栋梁</td>\n",
       "      <td>9373000</td>\n",
       "      <td>866000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>西安交通大学</td>\n",
       "      <td>西安交通大学</td>\n",
       "      <td>XJTU521</td>\n",
       "      <td>承继百廿南洋道统 弘扬甲子西迁精神合作投稿请私信</td>\n",
       "      <td>2038000</td>\n",
       "      <td>571000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>厦门大学</td>\n",
       "      <td>厦门大学官方抖音号</td>\n",
       "      <td>XMU19210406</td>\n",
       "      <td>自强不息 止于至善欢迎投稿:tvtg@xmu.edu.cn</td>\n",
       "      <td>3453000</td>\n",
       "      <td>551000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>北京航空航天大学</td>\n",
       "      <td>北京航空航天大学官方抖音号</td>\n",
       "      <td>Beihang1952</td>\n",
       "      <td>德才兼备，知行合一</td>\n",
       "      <td>4954000</td>\n",
       "      <td>454000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>南开大学</td>\n",
       "      <td>南开大学官方抖音号</td>\n",
       "      <td>NKU19191017</td>\n",
       "      <td>允公允能，日新月异公共投稿邮箱：Nankaidouyin@163.com</td>\n",
       "      <td>5691000</td>\n",
       "      <td>448000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>吉林大学</td>\n",
       "      <td>吉林大学官方抖音账号</td>\n",
       "      <td>JLU1946</td>\n",
       "      <td>求实创新，励志图强我就是那个有六个校区，而且特别特别大的“双一流”、“985工程”高校～投稿...</td>\n",
       "      <td>12336000</td>\n",
       "      <td>443000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>四川大学</td>\n",
       "      <td>四川大学官方抖音号</td>\n",
       "      <td>SCU1896</td>\n",
       "      <td>岷峨挺秀，锦水含章；巍巍学府，德渥群芳。你好，这里是四川大学。校园视频投稿：scuxmtlm...</td>\n",
       "      <td>5151000</td>\n",
       "      <td>394000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>山东大学</td>\n",
       "      <td>山东大学官方抖音号</td>\n",
       "      <td>1901SDU</td>\n",
       "      <td>学无止境，气有浩然欢迎来稿：sdunmc@sdu.edu.cn（投稿可私信）</td>\n",
       "      <td>3780000</td>\n",
       "      <td>345000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>天津大学</td>\n",
       "      <td>天津大学官方抖音号</td>\n",
       "      <td>tianda1895</td>\n",
       "      <td>中国第一所现代大学欢迎投稿 tjutv1895@163.com</td>\n",
       "      <td>1722000</td>\n",
       "      <td>314000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>东南大学</td>\n",
       "      <td>东南大学官方抖音账号</td>\n",
       "      <td>Seu190266</td>\n",
       "      <td>985 211 “双一流”建设A类高校</td>\n",
       "      <td>4762000</td>\n",
       "      <td>284000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>电子科技大学</td>\n",
       "      <td>电子科技大学官方抖音</td>\n",
       "      <td>UESTC1956</td>\n",
       "      <td>求实求真  大气大为</td>\n",
       "      <td>1090000</td>\n",
       "      <td>268000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>大连理工大学</td>\n",
       "      <td>大连理工大学官方账号</td>\n",
       "      <td>iduter</td>\n",
       "      <td>讲述大工故事 传递大工声音 交流师生感悟 凝聚爱校情怀</td>\n",
       "      <td>2520000</td>\n",
       "      <td>267000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>兰州大学</td>\n",
       "      <td>兰州大学官方抖音号</td>\n",
       "      <td>LZU1909</td>\n",
       "      <td>自强不息，独树一帜</td>\n",
       "      <td>3147000</td>\n",
       "      <td>254000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>同济大学</td>\n",
       "      <td>同济大学官方抖音号</td>\n",
       "      <td>Tongji_1907</td>\n",
       "      <td>同心同德同舟楫 济人济事济天下我是同济，请给我比心吧</td>\n",
       "      <td>1609000</td>\n",
       "      <td>238000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>华东师范大学</td>\n",
       "      <td>华东师范大学官方抖音号</td>\n",
       "      <td>ecnu</td>\n",
       "      <td>求实创造，为人师表。公众投稿及联系邮箱：ecnuxcb@admin.ecnu.edu.cn</td>\n",
       "      <td>1943000</td>\n",
       "      <td>230000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>湖南大学</td>\n",
       "      <td>湖南大学官方抖音号</td>\n",
       "      <td>HNU1926</td>\n",
       "      <td>实事求是 敢为人先</td>\n",
       "      <td>2203000</td>\n",
       "      <td>222000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>重庆大学</td>\n",
       "      <td>重庆大学官方抖音号</td>\n",
       "      <td>cqdx19291012</td>\n",
       "      <td>耐劳苦 尚俭朴 勤学业 爱国家投稿邮箱 video@yuxiaowei.cn</td>\n",
       "      <td>749000</td>\n",
       "      <td>184000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>中南大学</td>\n",
       "      <td>中南大学官方抖音</td>\n",
       "      <td>CSU0429</td>\n",
       "      <td>知行合一    经世致用向善求真    唯美有容融入中南大学，实现人生理想。公众投稿及联系邮...</td>\n",
       "      <td>1853000</td>\n",
       "      <td>179000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>西北工业大学</td>\n",
       "      <td>西北工业大学官方抖音号</td>\n",
       "      <td>npustar</td>\n",
       "      <td>欢迎投稿：291884513@qq.com</td>\n",
       "      <td>325000</td>\n",
       "      <td>144000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>中国科学技术大学</td>\n",
       "      <td>中国科学技术大学</td>\n",
       "      <td>ustcnews</td>\n",
       "      <td>创寰宇学府 育天下英才</td>\n",
       "      <td>937000</td>\n",
       "      <td>118000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>中国农业大学</td>\n",
       "      <td>中国农业大学官方</td>\n",
       "      <td>CAU1905</td>\n",
       "      <td>中国农业大学官方</td>\n",
       "      <td>58000</td>\n",
       "      <td>110000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>西北农林科技大学</td>\n",
       "      <td>西北农林科技大学官方抖音账号</td>\n",
       "      <td>NWAFU1934</td>\n",
       "      <td>诚朴勇毅        经国本，解民生，尚科学欢迎各位西农er投稿（一经采纳会有小礼物哦）：...</td>\n",
       "      <td>1358000</td>\n",
       "      <td>103000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>北京理工大学</td>\n",
       "      <td>北京理工大学官方抖音号</td>\n",
       "      <td>BIT_1940</td>\n",
       "      <td>德以明理，学以精工。</td>\n",
       "      <td>996000</td>\n",
       "      <td>98000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>中国海洋大学</td>\n",
       "      <td>中国海洋大学官方抖音账号</td>\n",
       "      <td>OUC1924</td>\n",
       "      <td>海纳百川，取则行远。hey这里是小海，欢迎来撩~</td>\n",
       "      <td>504000</td>\n",
       "      <td>88000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>哈尔滨工业大学</td>\n",
       "      <td>哈尔滨工业大学官方抖音</td>\n",
       "      <td>iHIT1920</td>\n",
       "      <td>在这里，你将看到不一样的哈工大</td>\n",
       "      <td>139000</td>\n",
       "      <td>83000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>华南理工大学</td>\n",
       "      <td>华南理工大学官方抖音号</td>\n",
       "      <td>SCUT1952</td>\n",
       "      <td>博学慎思 明辨笃行</td>\n",
       "      <td>76000</td>\n",
       "      <td>76000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>中央民族大学</td>\n",
       "      <td>中央民族大学官方账号</td>\n",
       "      <td>MUC1951</td>\n",
       "      <td>美美与共，知行合一。</td>\n",
       "      <td>356000</td>\n",
       "      <td>62000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>南京大学</td>\n",
       "      <td>南京大学抖音官方账号</td>\n",
       "      <td>44494962529</td>\n",
       "      <td>南京大学抖音官方账号投稿邮箱:media@nju.edu.cn</td>\n",
       "      <td>84000</td>\n",
       "      <td>59000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>东北大学</td>\n",
       "      <td>东北大学官方抖音账号</td>\n",
       "      <td>NEU_1923</td>\n",
       "      <td>自强不息，知行合一投稿&amp;联系我们：3554513629@qq.com</td>\n",
       "      <td>474000</td>\n",
       "      <td>41000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        账号名称            认证名称           抖音号  \\\n",
       "0       清华大学       清华大学官方抖音号  Tsinghua1911   \n",
       "1       北京大学       北京大学官方抖音号      PKU_1898   \n",
       "2     国防科技大学     国防科技大学官方抖音号    1979202900   \n",
       "3       浙江大学        浙江大学官方账号       zju1897   \n",
       "4       武汉大学        武汉大学官方抖音    luojia1893   \n",
       "5     上海交通大学    上海交通大学官方抖音账号          SJTU   \n",
       "6       复旦大学        复旦大学官方抖音       FDU1905   \n",
       "7     北京师范大学     北京师范大学官方抖音号       bnu1902   \n",
       "8     华中科技大学      华中科技大学官方账号     hust_1952   \n",
       "9     中国人民大学      中国人民大学官方账号       RUC1937   \n",
       "10    西安交通大学          西安交通大学       XJTU521   \n",
       "11      厦门大学       厦门大学官方抖音号   XMU19210406   \n",
       "12  北京航空航天大学   北京航空航天大学官方抖音号   Beihang1952   \n",
       "13      南开大学       南开大学官方抖音号   NKU19191017   \n",
       "14      吉林大学      吉林大学官方抖音账号       JLU1946   \n",
       "15      四川大学       四川大学官方抖音号       SCU1896   \n",
       "16      山东大学       山东大学官方抖音号       1901SDU   \n",
       "17      天津大学       天津大学官方抖音号    tianda1895   \n",
       "18      东南大学      东南大学官方抖音账号     Seu190266   \n",
       "19    电子科技大学      电子科技大学官方抖音     UESTC1956   \n",
       "20    大连理工大学      大连理工大学官方账号        iduter   \n",
       "21      兰州大学       兰州大学官方抖音号       LZU1909   \n",
       "22      同济大学       同济大学官方抖音号   Tongji_1907   \n",
       "23    华东师范大学     华东师范大学官方抖音号          ecnu   \n",
       "24      湖南大学       湖南大学官方抖音号       HNU1926   \n",
       "25      重庆大学       重庆大学官方抖音号  cqdx19291012   \n",
       "26      中南大学        中南大学官方抖音       CSU0429   \n",
       "27    西北工业大学     西北工业大学官方抖音号       npustar   \n",
       "28  中国科学技术大学        中国科学技术大学      ustcnews   \n",
       "29    中国农业大学        中国农业大学官方       CAU1905   \n",
       "30  西北农林科技大学  西北农林科技大学官方抖音账号     NWAFU1934   \n",
       "31    北京理工大学     北京理工大学官方抖音号      BIT_1940   \n",
       "32    中国海洋大学    中国海洋大学官方抖音账号       OUC1924   \n",
       "33   哈尔滨工业大学     哈尔滨工业大学官方抖音      iHIT1920   \n",
       "34    华南理工大学     华南理工大学官方抖音号      SCUT1952   \n",
       "35    中央民族大学      中央民族大学官方账号       MUC1951   \n",
       "36      南京大学      南京大学抖音官方账号   44494962529   \n",
       "37      东北大学      东北大学官方抖音账号      NEU_1923   \n",
       "\n",
       "                                                   简介   获赞数_int  粉丝数_int  \n",
       "0                            自强不息 厚德载物在这里你将看到不一样的清华大学  28768000  7156000  \n",
       "1   直播预告：3.15 15:00 中国经济观察3.16 19:00古代希腊的英雄主义3.17 ...  32159000  6267000  \n",
       "2                         厚德博学，强军兴国投稿邮箱：nudtdy@qq.com  63277000  4230000  \n",
       "3                                    求是 创新在这里记录不一样的浙大  36419000  1746000  \n",
       "4            珞珈之山 东湖之水 山高水长 流风甚美投稿邮箱：whuvideo@163.com  16573000  1310000  \n",
       "5           饮水思源，爱国荣校。投稿及联系邮箱：zxyzaa-0210@sjtu.edu.cn  12331000  1112000  \n",
       "6                                         博学而笃志 切问而近思   3094000  1037000  \n",
       "7                                            咦，被你发现了！   5942000   941000  \n",
       "8                                华中大官抖，带你了解不一样的华中科技大学  13734000   881000  \n",
       "9                                           国民表率 社会栋梁   9373000   866000  \n",
       "10                           承继百廿南洋道统 弘扬甲子西迁精神合作投稿请私信   2038000   571000  \n",
       "11                      自强不息 止于至善欢迎投稿:tvtg@xmu.edu.cn   3453000   551000  \n",
       "12                                          德才兼备，知行合一   4954000   454000  \n",
       "13               允公允能，日新月异公共投稿邮箱：Nankaidouyin@163.com   5691000   448000  \n",
       "14  求实创新，励志图强我就是那个有六个校区，而且特别特别大的“双一流”、“985工程”高校～投稿...  12336000   443000  \n",
       "15  岷峨挺秀，锦水含章；巍巍学府，德渥群芳。你好，这里是四川大学。校园视频投稿：scuxmtlm...   5151000   394000  \n",
       "16             学无止境，气有浩然欢迎来稿：sdunmc@sdu.edu.cn（投稿可私信）   3780000   345000  \n",
       "17                    中国第一所现代大学欢迎投稿 tjutv1895@163.com   1722000   314000  \n",
       "18                                985 211 “双一流”建设A类高校   4762000   284000  \n",
       "19                                         求实求真  大气大为   1090000   268000  \n",
       "20                        讲述大工故事 传递大工声音 交流师生感悟 凝聚爱校情怀   2520000   267000  \n",
       "21                                          自强不息，独树一帜   3147000   254000  \n",
       "22                         同心同德同舟楫 济人济事济天下我是同济，请给我比心吧   1609000   238000  \n",
       "23      求实创造，为人师表。公众投稿及联系邮箱：ecnuxcb@admin.ecnu.edu.cn   1943000   230000  \n",
       "24                                          实事求是 敢为人先   2203000   222000  \n",
       "25             耐劳苦 尚俭朴 勤学业 爱国家投稿邮箱 video@yuxiaowei.cn    749000   184000  \n",
       "26  知行合一    经世致用向善求真    唯美有容融入中南大学，实现人生理想。公众投稿及联系邮...   1853000   179000  \n",
       "27                              欢迎投稿：291884513@qq.com    325000   144000  \n",
       "28                                        创寰宇学府 育天下英才    937000   118000  \n",
       "29                                           中国农业大学官方     58000   110000  \n",
       "30  诚朴勇毅        经国本，解民生，尚科学欢迎各位西农er投稿（一经采纳会有小礼物哦）：...   1358000   103000  \n",
       "31                                         德以明理，学以精工。    996000    98000  \n",
       "32                           海纳百川，取则行远。hey这里是小海，欢迎来撩~    504000    88000  \n",
       "33                                    在这里，你将看到不一样的哈工大    139000    83000  \n",
       "34                                          博学慎思 明辨笃行     76000    76000  \n",
       "35                                         美美与共，知行合一。    356000    62000  \n",
       "36                    南京大学抖音官方账号投稿邮箱:media@nju.edu.cn     84000    59000  \n",
       "37                 自强不息，知行合一投稿&联系我们：3554513629@qq.com    474000    41000  "
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 数据准备\n",
    "import pandas as pd\n",
    "pd.read_csv('data/985.txt')\n",
    "df = pd.read_csv('data/985.txt')\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['账号名称', '认证名称', '抖音号', '简介', '获赞数_int', '粉丝数_int']"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns.tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['获赞数_int', '粉丝数_int']"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 获赞数和粉丝数\n",
    "group = [df.columns.tolist()[4],df.columns.tolist()[5]]\n",
    "group"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0         清华大学\n",
       "1         北京大学\n",
       "2       国防科技大学\n",
       "3         浙江大学\n",
       "4         武汉大学\n",
       "5       上海交通大学\n",
       "6         复旦大学\n",
       "7       北京师范大学\n",
       "8       华中科技大学\n",
       "9       中国人民大学\n",
       "10      西安交通大学\n",
       "11        厦门大学\n",
       "12    北京航空航天大学\n",
       "13        南开大学\n",
       "14        吉林大学\n",
       "15        四川大学\n",
       "16        山东大学\n",
       "17        天津大学\n",
       "18        东南大学\n",
       "19      电子科技大学\n",
       "20      大连理工大学\n",
       "21        兰州大学\n",
       "22        同济大学\n",
       "23      华东师范大学\n",
       "24        湖南大学\n",
       "25        重庆大学\n",
       "26        中南大学\n",
       "27      西北工业大学\n",
       "28    中国科学技术大学\n",
       "29      中国农业大学\n",
       "30    西北农林科技大学\n",
       "31      北京理工大学\n",
       "32      中国海洋大学\n",
       "33     哈尔滨工业大学\n",
       "34      华南理工大学\n",
       "35      中央民族大学\n",
       "36        南京大学\n",
       "37        东北大学\n",
       "Name: 账号名称, dtype: object"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "university = df['账号名称']\n",
    "university"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('清华大学', '获赞数_int'),\n",
       " ('清华大学', '粉丝数_int'),\n",
       " ('北京大学', '获赞数_int'),\n",
       " ('北京大学', '粉丝数_int'),\n",
       " ('国防科技大学', '获赞数_int'),\n",
       " ('国防科技大学', '粉丝数_int'),\n",
       " ('浙江大学', '获赞数_int'),\n",
       " ('浙江大学', '粉丝数_int'),\n",
       " ('武汉大学', '获赞数_int'),\n",
       " ('武汉大学', '粉丝数_int'),\n",
       " ('上海交通大学', '获赞数_int'),\n",
       " ('上海交通大学', '粉丝数_int'),\n",
       " ('复旦大学', '获赞数_int'),\n",
       " ('复旦大学', '粉丝数_int'),\n",
       " ('北京师范大学', '获赞数_int'),\n",
       " ('北京师范大学', '粉丝数_int'),\n",
       " ('华中科技大学', '获赞数_int'),\n",
       " ('华中科技大学', '粉丝数_int'),\n",
       " ('中国人民大学', '获赞数_int'),\n",
       " ('中国人民大学', '粉丝数_int'),\n",
       " ('西安交通大学', '获赞数_int'),\n",
       " ('西安交通大学', '粉丝数_int'),\n",
       " ('厦门大学', '获赞数_int'),\n",
       " ('厦门大学', '粉丝数_int'),\n",
       " ('北京航空航天大学', '获赞数_int'),\n",
       " ('北京航空航天大学', '粉丝数_int'),\n",
       " ('南开大学', '获赞数_int'),\n",
       " ('南开大学', '粉丝数_int'),\n",
       " ('吉林大学', '获赞数_int'),\n",
       " ('吉林大学', '粉丝数_int'),\n",
       " ('四川大学', '获赞数_int'),\n",
       " ('四川大学', '粉丝数_int'),\n",
       " ('山东大学', '获赞数_int'),\n",
       " ('山东大学', '粉丝数_int'),\n",
       " ('天津大学', '获赞数_int'),\n",
       " ('天津大学', '粉丝数_int'),\n",
       " ('东南大学', '获赞数_int'),\n",
       " ('东南大学', '粉丝数_int'),\n",
       " ('电子科技大学', '获赞数_int'),\n",
       " ('电子科技大学', '粉丝数_int'),\n",
       " ('大连理工大学', '获赞数_int'),\n",
       " ('大连理工大学', '粉丝数_int'),\n",
       " ('兰州大学', '获赞数_int'),\n",
       " ('兰州大学', '粉丝数_int'),\n",
       " ('同济大学', '获赞数_int'),\n",
       " ('同济大学', '粉丝数_int'),\n",
       " ('华东师范大学', '获赞数_int'),\n",
       " ('华东师范大学', '粉丝数_int'),\n",
       " ('湖南大学', '获赞数_int'),\n",
       " ('湖南大学', '粉丝数_int'),\n",
       " ('重庆大学', '获赞数_int'),\n",
       " ('重庆大学', '粉丝数_int'),\n",
       " ('中南大学', '获赞数_int'),\n",
       " ('中南大学', '粉丝数_int'),\n",
       " ('西北工业大学', '获赞数_int'),\n",
       " ('西北工业大学', '粉丝数_int'),\n",
       " ('中国科学技术大学', '获赞数_int'),\n",
       " ('中国科学技术大学', '粉丝数_int'),\n",
       " ('中国农业大学', '获赞数_int'),\n",
       " ('中国农业大学', '粉丝数_int'),\n",
       " ('西北农林科技大学', '获赞数_int'),\n",
       " ('西北农林科技大学', '粉丝数_int'),\n",
       " ('北京理工大学', '获赞数_int'),\n",
       " ('北京理工大学', '粉丝数_int'),\n",
       " ('中国海洋大学', '获赞数_int'),\n",
       " ('中国海洋大学', '粉丝数_int'),\n",
       " ('哈尔滨工业大学', '获赞数_int'),\n",
       " ('哈尔滨工业大学', '粉丝数_int'),\n",
       " ('华南理工大学', '获赞数_int'),\n",
       " ('华南理工大学', '粉丝数_int'),\n",
       " ('中央民族大学', '获赞数_int'),\n",
       " ('中央民族大学', '粉丝数_int'),\n",
       " ('南京大学', '获赞数_int'),\n",
       " ('南京大学', '粉丝数_int'),\n",
       " ('东北大学', '获赞数_int'),\n",
       " ('东北大学', '粉丝数_int')]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 准备x轴坐标数据\n",
    "x = [ (school, categroy) for school in university for categroy in group ]\n",
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(28768000, 7156000, 32159000, 6267000, 63277000, 4230000, 36419000, 1746000, 16573000, 1310000, 12331000, 1112000, 3094000, 1037000, 5942000, 941000, 13734000, 881000, 9373000, 866000, 2038000, 571000, 3453000, 551000, 4954000, 454000, 5691000, 448000, 12336000, 443000, 5151000, 394000, 3780000, 345000, 1722000, 314000, 4762000, 284000, 1090000, 268000, 2520000, 267000, 3147000, 254000, 1609000, 238000, 1943000, 230000, 2203000, 222000, 749000, 184000, 1853000, 179000, 325000, 144000, 937000, 118000, 58000, 110000, 1358000, 103000, 996000, 98000, 504000, 88000, 139000, 83000, 76000, 76000, 356000, 62000, 84000, 59000, 474000, 41000)\n"
     ]
    }
   ],
   "source": [
    "# 准备y轴坐标数据\n",
    "y = sum(zip(df['获赞数_int'], df['粉丝数_int']), ())\n",
    "print(y)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 分组柱状图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"ceeef568-efa6-4d2a-b09e-d863390a1fe1\" data-root-id=\"1319\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"f1ec514e-2569-428d-af56-8c7d734e4782\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1329\"}],\"center\":[{\"id\":\"1331\"},{\"id\":\"1335\"}],\"left\":[{\"id\":\"1332\"}],\"plot_height\":400,\"plot_width\":2800,\"renderers\":[{\"id\":\"1356\"}],\"title\":{\"id\":\"1320\"},\"toolbar\":{\"id\":\"1344\"},\"x_range\":{\"id\":\"1318\"},\"x_scale\":{\"id\":\"1325\"},\"y_range\":{\"id\":\"1323\"},\"y_scale\":{\"id\":\"1327\"}},\"id\":\"1319\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1330\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"start\":0},\"id\":\"1323\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1387\",\"type\":\"Selection\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1336\"},{\"id\":\"1337\"},{\"id\":\"1338\"},{\"id\":\"1339\"},{\"id\":\"1340\"},{\"id\":\"1341\"},{\"id\":\"1343\"}]},\"id\":\"1344\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1384\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"axis\":{\"id\":\"1329\"},\"ticker\":null},\"id\":\"1331\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1339\",\"type\":\"SaveTool\"},{\"attributes\":{\"fill_color\":{\"field\":\"x_axis\",\"transform\":{\"id\":\"1352\"}},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"y_counts\"},\"width\":{\"value\":0.9},\"x\":{\"field\":\"x_axis\"}},\"id\":\"1354\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"1336\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1340\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1337\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"field\":\"x_axis\",\"transform\":{\"id\":\"1352\"}},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"y_counts\"},\"width\":{\"value\":0.9},\"x\":{\"field\":\"x_axis\"}},\"id\":\"1355\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"1388\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1386\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"data\":{\"x_axis\":[[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e1c\\u5317\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e1c\\u5317\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"]],\"y_counts\":[28768000,7156000,32159000,6267000,63277000,4230000,36419000,1746000,16573000,1310000,12331000,1112000,3094000,1037000,5942000,941000,13734000,881000,9373000,866000,2038000,571000,3453000,551000,4954000,454000,5691000,448000,12336000,443000,5151000,394000,3780000,345000,1722000,314000,4762000,284000,1090000,268000,2520000,267000,3147000,254000,1609000,238000,1943000,230000,2203000,222000,749000,184000,1853000,179000,325000,144000,937000,118000,58000,110000,1358000,103000,996000,98000,504000,88000,139000,83000,76000,76000,356000,62000,84000,59000,474000,41000]},\"selected\":{\"id\":\"1387\"},\"selection_policy\":{\"id\":\"1388\"}},\"id\":\"1317\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1341\",\"type\":\"HelpTool\"},{\"attributes\":{\"data_source\":{\"id\":\"1317\"},\"glyph\":{\"id\":\"1354\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1355\"},\"selection_glyph\":null,\"view\":{\"id\":\"1357\"}},\"id\":\"1356\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"end\":2,\"factors\":[\"\\u83b7\\u8d5e\\u6570_int\",\"\\u7c89\\u4e1d\\u6570_int\"],\"palette\":[\"red\",\"green\"],\"start\":1},\"id\":\"1352\",\"type\":\"CategoricalColorMapper\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1342\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1325\",\"type\":\"CategoricalScale\"},{\"attributes\":{},\"id\":\"1327\",\"type\":\"LinearScale\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"counts\",\"@y_counts\"],[\"detail\",\"@x_axis\"]]},\"id\":\"1343\",\"type\":\"HoverTool\"},{\"attributes\":{\"text\":\"985\\u9662\\u6821\\u6296\\u97f3\\u83b7\\u8d5e\\u6570\\u3001\\u7c89\\u4e1d\\u6570\\u67f1\\u5f62\\u56fe\"},\"id\":\"1320\",\"type\":\"Title\"},{\"attributes\":{\"formatter\":{\"id\":\"1384\"},\"ticker\":{\"id\":\"1333\"}},\"id\":\"1332\",\"type\":\"LinearAxis\"},{\"attributes\":{\"axis\":{\"id\":\"1332\"},\"dimension\":1,\"ticker\":null},\"id\":\"1335\",\"type\":\"Grid\"},{\"attributes\":{\"factors\":[[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e1c\\u5317\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e1c\\u5317\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"]],\"range_padding\":0.1},\"id\":\"1318\",\"type\":\"FactorRange\"},{\"attributes\":{\"formatter\":{\"id\":\"1386\"},\"major_label_orientation\":1,\"ticker\":{\"id\":\"1330\"}},\"id\":\"1329\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"source\":{\"id\":\"1317\"}},\"id\":\"1357\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1333\",\"type\":\"BasicTicker\"},{\"attributes\":{\"overlay\":{\"id\":\"1342\"}},\"id\":\"1338\",\"type\":\"BoxZoomTool\"}],\"root_ids\":[\"1319\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"f1ec514e-2569-428d-af56-8c7d734e4782\",\"root_ids\":[\"1319\"],\"roots\":{\"1319\":\"ceeef568-efa6-4d2a-b09e-d863390a1fe1\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1319"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 分组柱状图\n",
    "from bokeh.transform import factor_cmap\n",
    "source = ColumnDataSource(\n",
    "    data = dict(\n",
    "        x_axis = x,\n",
    "        y_counts = y,     \n",
    "    )\n",
    ")\n",
    "palette = [\"red\", \"green\"]\n",
    "# 点击数据 tooltips\n",
    "TOOLTIPS = [\n",
    "    (\"counts\",\"@y_counts\"),\n",
    "    (\"detail\",\"@x_axis\")\n",
    "]\n",
    "# 画布\n",
    "p = figure(\n",
    "    x_range=FactorRange(*x),\n",
    "    plot_width=2800,\n",
    "    plot_height=400,\n",
    "    title=\"985院校抖音获赞数、粉丝数柱形图\",\n",
    "    tooltips=TOOLTIPS\n",
    ")\n",
    "# 绘制图形 vbar 垂直柱状图\n",
    "p.vbar(\n",
    "    x='x_axis',\n",
    "    top=\"y_counts\",\n",
    "    width=0.9,\n",
    "    source=source,\n",
    "    fill_color=factor_cmap('x_axis', palette=palette, factors=group, start=1, end=2)\n",
    ")\n",
    "p.y_range.start = 0\n",
    "p.x_range.range_padding = 0.1\n",
    "p.xaxis.major_label_orientation = 1\n",
    "\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 分组折线图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"dd9e2e71-00c2-41b3-8f9f-2ad201d34878\" data-root-id=\"1439\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"b4dbb739-dcc3-4dc2-afaa-44fde48fe6f2\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1449\"}],\"center\":[{\"id\":\"1451\"},{\"id\":\"1455\"},{\"id\":\"1487\"}],\"left\":[{\"id\":\"1452\"}],\"plot_height\":500,\"plot_width\":3000,\"renderers\":[{\"id\":\"1477\"},{\"id\":\"1492\"}],\"title\":{\"id\":\"1440\"},\"toolbar\":{\"id\":\"1464\"},\"x_range\":{\"id\":\"1438\"},\"x_scale\":{\"id\":\"1445\"},\"y_range\":{\"id\":\"1443\"},\"y_scale\":{\"id\":\"1447\"}},\"id\":\"1439\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1485\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1459\",\"type\":\"SaveTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1462\"}},\"id\":\"1458\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1462\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"source\":{\"id\":\"1472\"}},\"id\":\"1478\",\"type\":\"CDSView\"},{\"attributes\":{\"click_policy\":\"hide\",\"items\":[{\"id\":\"1488\"},{\"id\":\"1504\"}],\"location\":\"top_left\"},\"id\":\"1487\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"1445\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"text\":\"985\\u9662\\u6821\\u6296\\u97f3\\u83b7\\u8d5e\\u6570\\u3001\\u7c89\\u4e1d\\u6570\\u6298\\u7ebf\\u56fe\"},\"id\":\"1440\",\"type\":\"Title\"},{\"attributes\":{\"formatter\":{\"id\":\"1481\"},\"ticker\":{\"id\":\"1453\"}},\"id\":\"1452\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1483\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"data_source\":{\"id\":\"1473\"},\"glyph\":{\"id\":\"1490\"},\"hover_glyph\":null,\"muted_glyph\":null,\"name\":\"fans_counts\",\"nonselection_glyph\":{\"id\":\"1491\"},\"selection_glyph\":null,\"view\":{\"id\":\"1493\"}},\"id\":\"1492\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1456\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1484\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1443\",\"type\":\"DataRange1d\"},{\"attributes\":{\"axis\":{\"id\":\"1449\"},\"ticker\":null},\"id\":\"1451\",\"type\":\"Grid\"},{\"attributes\":{\"data\":{\"good_counts\":[28768000,32159000,63277000,36419000,16573000,12331000,3094000,5942000,13734000,9373000,2038000,3453000,4954000,5691000,12336000,5151000,3780000,1722000,4762000,1090000,2520000,3147000,1609000,1943000,2203000,749000,1853000,325000,937000,58000,1358000,996000,504000,139000,76000,356000,84000,474000],\"good_university\":[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u4e1c\\u5317\\u5927\\u5b66\"],\"x_axis\":[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u4e1c\\u5317\\u5927\\u5b66\"],\"y_counts\":[28768000,32159000,63277000,36419000,16573000,12331000,3094000,5942000,13734000,9373000,2038000,3453000,4954000,5691000,12336000,5151000,3780000,1722000,4762000,1090000,2520000,3147000,1609000,1943000,2203000,749000,1853000,325000,937000,58000,1358000,996000,504000,139000,76000,356000,84000,474000]},\"selected\":{\"id\":\"1484\"},\"selection_policy\":{\"id\":\"1485\"}},\"id\":\"1472\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"formatter\":{\"id\":\"1483\"},\"ticker\":{\"id\":\"1450\"}},\"id\":\"1449\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1456\"},{\"id\":\"1457\"},{\"id\":\"1458\"},{\"id\":\"1459\"},{\"id\":\"1460\"},{\"id\":\"1461\"},{\"id\":\"1463\"}]},\"id\":\"1464\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1481\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1450\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"1472\"},\"glyph\":{\"id\":\"1475\"},\"hover_glyph\":null,\"muted_glyph\":null,\"name\":\"good_counts\",\"nonselection_glyph\":{\"id\":\"1476\"},\"selection_glyph\":null,\"view\":{\"id\":\"1478\"}},\"id\":\"1477\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"school\",\"@x_axis\"],[\"counts\",\"@y_counts\"]]},\"id\":\"1463\",\"type\":\"HoverTool\"},{\"attributes\":{\"data\":{\"fans_counts\":[7156000,6267000,4230000,1746000,1310000,1112000,1037000,941000,881000,866000,571000,551000,454000,448000,443000,394000,345000,314000,284000,268000,267000,254000,238000,230000,222000,184000,179000,144000,118000,110000,103000,98000,88000,83000,76000,62000,59000,41000],\"fans_university\":[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u4e1c\\u5317\\u5927\\u5b66\"],\"x_axis\":[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u4e1c\\u5317\\u5927\\u5b66\"],\"y_counts\":[7156000,6267000,4230000,1746000,1310000,1112000,1037000,941000,881000,866000,571000,551000,454000,448000,443000,394000,345000,314000,284000,268000,267000,254000,238000,230000,222000,184000,179000,144000,118000,110000,103000,98000,88000,83000,76000,62000,59000,41000]},\"selected\":{\"id\":\"1501\"},\"selection_policy\":{\"id\":\"1502\"}},\"id\":\"1473\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_alpha\":0.6,\"line_color\":\"green\",\"line_width\":2,\"x\":{\"field\":\"fans_university\"},\"y\":{\"field\":\"fans_counts\"}},\"id\":\"1490\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1457\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"label\":{\"value\":\"\\u7c89\\u4e1d\\u6570\"},\"renderers\":[{\"id\":\"1492\"}]},\"id\":\"1504\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_alpha\":0.6,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"good_university\"},\"y\":{\"field\":\"good_counts\"}},\"id\":\"1475\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1461\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1501\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1447\",\"type\":\"LinearScale\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"good_university\"},\"y\":{\"field\":\"good_counts\"}},\"id\":\"1476\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1502\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"label\":{\"value\":\"\\u83b7\\u8d5e\\u6570\"},\"renderers\":[{\"id\":\"1477\"}]},\"id\":\"1488\",\"type\":\"LegendItem\"},{\"attributes\":{\"factors\":[[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e1c\\u5317\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e1c\\u5317\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"]]},\"id\":\"1438\",\"type\":\"FactorRange\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"green\",\"line_width\":2,\"x\":{\"field\":\"fans_university\"},\"y\":{\"field\":\"fans_counts\"}},\"id\":\"1491\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1460\",\"type\":\"ResetTool\"},{\"attributes\":{\"source\":{\"id\":\"1473\"}},\"id\":\"1493\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1453\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1452\"},\"dimension\":1,\"ticker\":null},\"id\":\"1455\",\"type\":\"Grid\"}],\"root_ids\":[\"1439\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"b4dbb739-dcc3-4dc2-afaa-44fde48fe6f2\",\"root_ids\":[\"1439\"],\"roots\":{\"1439\":\"dd9e2e71-00c2-41b3-8f9f-2ad201d34878\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1439"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 2. 画布准备\n",
    "# 元组（‘参数名称’，‘参数的值’）\n",
    "TOOLTIPS = [\n",
    "    (\"school\",\"@x_axis\"),\n",
    "    (\"counts\", \"@y_counts\")\n",
    "]\n",
    "plot = figure(\n",
    "    x_range=FactorRange(*x),\n",
    "    title=\"985院校抖音获赞数、粉丝数折线图\",\n",
    "    plot_width=3000, \n",
    "    plot_height=500,\n",
    "    tooltips=TOOLTIPS\n",
    ")\n",
    "\n",
    "\n",
    "# 3. 数据准备（good)\n",
    "good_source = ColumnDataSource(\n",
    "    data = dict(\n",
    "        good_university = df['账号名称'],\n",
    "        good_counts = df['获赞数_int'],\n",
    "        x_axis = df['账号名称'],\n",
    "        y_counts = df['获赞数_int'],    \n",
    "    )\n",
    ")\n",
    "# good_source\n",
    "\n",
    "# 数据准备(fans)\n",
    "fans_source = ColumnDataSource(\n",
    "    data = dict(\n",
    "        fans_university = df['账号名称'],\n",
    "        fans_counts = df['粉丝数_int'],\n",
    "        x_axis = df['账号名称'],\n",
    "        y_counts = df['粉丝数_int'],\n",
    "    )\n",
    ")\n",
    "# fans_source\n",
    "\n",
    "# 4. 绘制图形\n",
    "plot.line(\n",
    "    x = 'good_university',\n",
    "    y = 'good_counts',\n",
    "    line_width=2,\n",
    "    color = \"red\",\n",
    "    alpha = 0.6,\n",
    "    legend = \"获赞数\",\n",
    "    source = good_source,\n",
    "    name = 'good_counts'\n",
    ")\n",
    "\n",
    "plot.line(\n",
    "    x = 'fans_university',\n",
    "    y ='fans_counts',\n",
    "    line_width=2,\n",
    "    color = 'green',\n",
    "    alpha = 0.6,\n",
    "    legend = \"粉丝数\",\n",
    "    source = fans_source,\n",
    "    name = 'fans_counts'\n",
    ")\n",
    "\n",
    "# 5. 图形的额外设置\n",
    "plot.legend.location='top_left'\n",
    "plot.legend.click_policy = 'hide'\n",
    "\n",
    "show(plot)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 分组散点图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"973f6fed-ad35-4ddd-bb63-799c598f0888\" data-root-id=\"2882\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"5d865742-afee-4d15-9554-0dd119ac9f1f\":{\"roots\":{\"references\":[{\"attributes\":{\"background_fill_color\":\"#fafafa\",\"below\":[{\"id\":\"2892\"}],\"center\":[{\"id\":\"2894\"},{\"id\":\"2898\"},{\"id\":\"2930\"}],\"left\":[{\"id\":\"2895\"}],\"plot_height\":500,\"plot_width\":3000,\"renderers\":[{\"id\":\"2920\"},{\"id\":\"2935\"}],\"title\":{\"id\":\"2883\"},\"toolbar\":{\"id\":\"2907\"},\"x_range\":{\"id\":\"2881\"},\"x_scale\":{\"id\":\"2888\"},\"y_range\":{\"id\":\"2886\"},\"y_scale\":{\"id\":\"2890\"}},\"id\":\"2882\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"2896\",\"type\":\"BasicTicker\"},{\"attributes\":{\"text\":\"985\\u9662\\u6821\\u6296\\u97f3\\u83b7\\u8d5e\\u6570\\u3001\\u7c89\\u4e1d\\u6570\\u6563\\u70b9\\u56fe\"},\"id\":\"2883\",\"type\":\"Title\"},{\"attributes\":{\"data_source\":{\"id\":\"2916\"},\"glyph\":{\"id\":\"2933\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"2934\"},\"selection_glyph\":null,\"view\":{\"id\":\"2936\"}},\"id\":\"2935\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"2899\"},{\"id\":\"2900\"},{\"id\":\"2901\"},{\"id\":\"2902\"},{\"id\":\"2903\"},{\"id\":\"2904\"},{\"id\":\"2906\"}]},\"id\":\"2907\",\"type\":\"Toolbar\"},{\"attributes\":{\"data\":{\"good_counts\":[28768000,32159000,63277000,36419000,16573000,12331000,3094000,5942000,13734000,9373000,2038000,3453000,4954000,5691000,12336000,5151000,3780000,1722000,4762000,1090000,2520000,3147000,1609000,1943000,2203000,749000,1853000,325000,937000,58000,1358000,996000,504000,139000,76000,356000,84000,474000],\"good_university\":[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u4e1c\\u5317\\u5927\\u5b66\"],\"x_axis\":[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u4e1c\\u5317\\u5927\\u5b66\"],\"y_counts\":[28768000,32159000,63277000,36419000,16573000,12331000,3094000,5942000,13734000,9373000,2038000,3453000,4954000,5691000,12336000,5151000,3780000,1722000,4762000,1090000,2520000,3147000,1609000,1943000,2203000,749000,1853000,325000,937000,58000,1358000,996000,504000,139000,76000,356000,84000,474000]},\"selected\":{\"id\":\"2927\"},\"selection_policy\":{\"id\":\"2928\"}},\"id\":\"2915\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"2926\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{},\"id\":\"2945\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"school\",\"@x_axis\"],[\"counts\",\"@y_counts\"]]},\"id\":\"2906\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"2927\",\"type\":\"Selection\"},{\"attributes\":{\"label\":{\"value\":\"\\u7c89\\u4e1d\\u91cf\"},\"renderers\":[{\"id\":\"2935\"}]},\"id\":\"2947\",\"type\":\"LegendItem\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.4},\"fill_color\":{\"value\":\"green\"},\"line_color\":{\"value\":\"green\"},\"size\":{\"units\":\"screen\",\"value\":12},\"x\":{\"field\":\"fans_university\"},\"y\":{\"field\":\"fans_counts\"}},\"id\":\"2933\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"2904\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"2903\",\"type\":\"ResetTool\"},{\"attributes\":{\"label\":{\"value\":\"\\u70b9\\u8d5e\\u6570\"},\"renderers\":[{\"id\":\"2920\"}]},\"id\":\"2931\",\"type\":\"LegendItem\"},{\"attributes\":{\"axis\":{\"id\":\"2892\"},\"ticker\":null},\"id\":\"2894\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2924\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"axis\":{\"id\":\"2895\"},\"dimension\":1,\"ticker\":null},\"id\":\"2898\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2899\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"2902\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"2893\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.4},\"fill_color\":{\"value\":\"red\"},\"line_color\":{\"value\":\"red\"},\"size\":{\"units\":\"screen\",\"value\":12},\"x\":{\"field\":\"good_university\"},\"y\":{\"field\":\"good_counts\"}},\"id\":\"2918\",\"type\":\"Scatter\"},{\"attributes\":{\"data_source\":{\"id\":\"2915\"},\"glyph\":{\"id\":\"2918\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"2919\"},\"selection_glyph\":null,\"view\":{\"id\":\"2921\"}},\"id\":\"2920\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"2915\"}},\"id\":\"2921\",\"type\":\"CDSView\"},{\"attributes\":{\"factors\":[[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"],[\"\\u4e1c\\u5317\\u5927\\u5b66\",\"\\u83b7\\u8d5e\\u6570_int\"],[\"\\u4e1c\\u5317\\u5927\\u5b66\",\"\\u7c89\\u4e1d\\u6570_int\"]]},\"id\":\"2881\",\"type\":\"FactorRange\"},{\"attributes\":{},\"id\":\"2900\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"items\":[{\"id\":\"2931\"},{\"id\":\"2947\"}]},\"id\":\"2930\",\"type\":\"Legend\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"green\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"green\"},\"size\":{\"units\":\"screen\",\"value\":12},\"x\":{\"field\":\"fans_university\"},\"y\":{\"field\":\"fans_counts\"}},\"id\":\"2934\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"2888\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"source\":{\"id\":\"2916\"}},\"id\":\"2936\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"2928\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"2944\",\"type\":\"Selection\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"2905\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"axis_label\":\"school\",\"formatter\":{\"id\":\"2926\"},\"ticker\":{\"id\":\"2893\"}},\"id\":\"2892\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"red\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"red\"},\"size\":{\"units\":\"screen\",\"value\":12},\"x\":{\"field\":\"good_university\"},\"y\":{\"field\":\"good_counts\"}},\"id\":\"2919\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"2886\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"2890\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis_label\":\"counts\",\"formatter\":{\"id\":\"2924\"},\"ticker\":{\"id\":\"2896\"}},\"id\":\"2895\",\"type\":\"LinearAxis\"},{\"attributes\":{\"data\":{\"fans_counts\":[7156000,6267000,4230000,1746000,1310000,1112000,1037000,941000,881000,866000,571000,551000,454000,448000,443000,394000,345000,314000,284000,268000,267000,254000,238000,230000,222000,184000,179000,144000,118000,110000,103000,98000,88000,83000,76000,62000,59000,41000],\"fans_university\":[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u4e1c\\u5317\\u5927\\u5b66\"],\"x_axis\":[\"\\u6e05\\u534e\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5927\\u5b66\",\"\\u56fd\\u9632\\u79d1\\u6280\\u5927\\u5b66\",\"\\u6d59\\u6c5f\\u5927\\u5b66\",\"\\u6b66\\u6c49\\u5927\\u5b66\",\"\\u4e0a\\u6d77\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u590d\\u65e6\\u5927\\u5b66\",\"\\u5317\\u4eac\\u5e08\\u8303\\u5927\\u5b66\",\"\\u534e\\u4e2d\\u79d1\\u6280\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u4eba\\u6c11\\u5927\\u5b66\",\"\\u897f\\u5b89\\u4ea4\\u901a\\u5927\\u5b66\",\"\\u53a6\\u95e8\\u5927\\u5b66\",\"\\u5317\\u4eac\\u822a\\u7a7a\\u822a\\u5929\\u5927\\u5b66\",\"\\u5357\\u5f00\\u5927\\u5b66\",\"\\u5409\\u6797\\u5927\\u5b66\",\"\\u56db\\u5ddd\\u5927\\u5b66\",\"\\u5c71\\u4e1c\\u5927\\u5b66\",\"\\u5929\\u6d25\\u5927\\u5b66\",\"\\u4e1c\\u5357\\u5927\\u5b66\",\"\\u7535\\u5b50\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5927\\u8fde\\u7406\\u5de5\\u5927\\u5b66\",\"\\u5170\\u5dde\\u5927\\u5b66\",\"\\u540c\\u6d4e\\u5927\\u5b66\",\"\\u534e\\u4e1c\\u5e08\\u8303\\u5927\\u5b66\",\"\\u6e56\\u5357\\u5927\\u5b66\",\"\\u91cd\\u5e86\\u5927\\u5b66\",\"\\u4e2d\\u5357\\u5927\\u5b66\",\"\\u897f\\u5317\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u79d1\\u5b66\\u6280\\u672f\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u519c\\u4e1a\\u5927\\u5b66\",\"\\u897f\\u5317\\u519c\\u6797\\u79d1\\u6280\\u5927\\u5b66\",\"\\u5317\\u4eac\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u56fd\\u6d77\\u6d0b\\u5927\\u5b66\",\"\\u54c8\\u5c14\\u6ee8\\u5de5\\u4e1a\\u5927\\u5b66\",\"\\u534e\\u5357\\u7406\\u5de5\\u5927\\u5b66\",\"\\u4e2d\\u592e\\u6c11\\u65cf\\u5927\\u5b66\",\"\\u5357\\u4eac\\u5927\\u5b66\",\"\\u4e1c\\u5317\\u5927\\u5b66\"],\"y_counts\":[7156000,6267000,4230000,1746000,1310000,1112000,1037000,941000,881000,866000,571000,551000,454000,448000,443000,394000,345000,314000,284000,268000,267000,254000,238000,230000,222000,184000,179000,144000,118000,110000,103000,98000,88000,83000,76000,62000,59000,41000]},\"selected\":{\"id\":\"2944\"},\"selection_policy\":{\"id\":\"2945\"}},\"id\":\"2916\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"overlay\":{\"id\":\"2905\"}},\"id\":\"2901\",\"type\":\"BoxZoomTool\"}],\"root_ids\":[\"2882\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"5d865742-afee-4d15-9554-0dd119ac9f1f\",\"root_ids\":[\"2882\"],\"roots\":{\"2882\":\"973f6fed-ad35-4ddd-bb63-799c598f0888\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "2882"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 画布\n",
    "TOOLTIPS = [\n",
    "    (\"school\",\"@x_axis\"),\n",
    "    (\"counts\", \"@y_counts\")\n",
    "]\n",
    "p = figure( \n",
    "    x_range=FactorRange(*x),\n",
    "    plot_width=3000, \n",
    "    plot_height=500,\n",
    "    title = \"985院校抖音获赞数、粉丝数散点图\",\n",
    "    background_fill_color=\"#fafafa\",\n",
    "    tooltips=TOOLTIPS\n",
    ")\n",
    "\n",
    "# 3. 数据准备（good)\n",
    "good_source = ColumnDataSource(\n",
    "    data = dict(\n",
    "        good_university = df['账号名称'],\n",
    "        good_counts = df['获赞数_int'],\n",
    "        x_axis = df['账号名称'],\n",
    "        y_counts = df['获赞数_int'],    \n",
    "    )\n",
    ")\n",
    "# good_source\n",
    "\n",
    "# 数据准备(fans)\n",
    "fans_source = ColumnDataSource(\n",
    "    data = dict(\n",
    "        fans_university = df['账号名称'],\n",
    "        fans_counts = df['粉丝数_int'],\n",
    "        x_axis = df['账号名称'],\n",
    "        y_counts = df['粉丝数_int'],\n",
    "    )\n",
    ")\n",
    "# fans_source\n",
    "# 绘图\n",
    "p.scatter(\"good_university\",\n",
    "          \"good_counts\",\n",
    "          source=good_source,\n",
    "          legend= \"点赞数\",\n",
    "          fill_alpha=0.4,\n",
    "          color = 'red',\n",
    "          size=12,\n",
    ")\n",
    "\n",
    "\n",
    "p.scatter(\"fans_university\",\n",
    "          \"fans_counts\",\n",
    "          source=fans_source,\n",
    "          legend= \"粉丝量\",\n",
    "          fill_alpha=0.4,\n",
    "          color = 'green',\n",
    "          size=12,\n",
    ")\n",
    "\n",
    "# 其他\n",
    "p.xaxis.axis_label = 'school'\n",
    "p.yaxis.axis_label = 'counts'\n",
    "# 显示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "461.482px",
    "left": "711px",
    "top": "111.019px",
    "width": "164.988px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
